#!/bin/bash

db_name={{ dbname_nacos }}
mysql_conn="{{ mysql_basedir }}/bin/mysql -u{{ mysql_db_user }} -p{{ mysql_db_pwd }} -S {{ mysql_basedir }}/mysql.sock"

#create database
${mysql_conn} -e "create database IF NOT EXISTS ${db_name}"

#import 
sql=`find /tmp -type f -name mysql-schema.sql 2>/dev/null |head -1`
${mysql_conn} ${db_name} < ${sql}

#${mysql_conn} ${db_name} << 'EOF'
#UPDATE users SET password = '$2a$10$O2VVUr2W6I/h/3YEGYa2VulKire8h1H4EOlmz3j6DhRC48iudkfBi' WHERE username = 'nacos';
#EOF
